//
//  ShareAction.swift
//  MagaCore
//
//  Created by MrMessy on 2023/5/13.
//

import Foundation
import ReSwift
import ReSwiftThunk
import Moya
import HandyJSON

enum HTEnumShareAction: Action {
  case htEnumConfig(var_share: HTShare?)

  // 获取分享数据
  static func ht_shareConfig(var_p1: String, var_p2: String) -> Thunk<HTAppState> {
    Thunk<HTAppState> { dispatch, _ in
      HTNetworkManager().ht_request(.htEnumShareConfig(var_p1: var_p1, var_p2: var_p2)) { (result) in
        let var_data = result.ht_data()
        let var_share = HTShare.deserialize(from: var_data)

        dispatch(HTEnumShareAction.htEnumConfig(var_share: var_share))
      }
    }
  }
}
